FROM public.ecr.aws/lambda/python:3.9

# Copy requirements.txt
COPY requirements.txt ${LAMBDA_TASK_ROOT}

# Install the specified packages
RUN yum -y install libgomp
RUN yum -y install mesa-libGL
RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install torch==2.0.1 torchvision==0.15.2 --index-url https://download.pytorch.org/whl/cpu

# Copy function code
COPY ocr_function.py ${LAMBDA_TASK_ROOT}
COPY oem_list_from_sf_claims.csv ${LAMBDA_TASK_ROOT}/data

#Copy models
COPY models ${LAMBDA_TASK_ROOT}/models

# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
CMD [ "ocr_function.lambda_handler" ]